Repository navigation
fix(claude): avoid repeating role in member subagent descriptions - #2554
Open
aloneangel45 wants to merge 1 commit into
Open
aloneangel45 wants to merge 1 commit into
aloneangel45 wants to merge 1 commit into
Conversation
aloneangel45
requested review from
bradygaster and
tamirdresher
as code owners
November 26, 2026 01:22
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The work-type filter uses a regex with quadratic backtracking on unbounded routing values, allowing a crafted row to block Claude member generation before the description-length limit applies.
1 open issue
What changed in this PR
This PR addresses #2528 by removing repeated role text from generated Claude member subagent descriptions.
Changes:
- Deduplicates matching names, roles, and routed work types while preserving explicit purpose text.
- Adds tests for normalization, mixed work types, and purpose precedence.
- Adds a patch changeset for
@bradygaster/squad-sdk.
| File | Description |
|---|---|
test/claude-members.test.ts |
Adds description deduplication regression tests. |
packages/squad-sdk/src/client/adapters/claude-members.ts |
Normalizes role comparisons and omits redundant description text. |
.changeset/fix-claude-member-role-dedup.md |
Records the SDK patch release change. |
Review effort: Balanced (adaptive)
Comment on lines
+148
to
+153
| const cleanRole = role?.replace(/[.\s]+$/, '').trim(); | ||
| const roleKey = cleanRole ? cleanRole.toLowerCase() : undefined; | ||
| const routed = routing | ||
| .filter((r) => r.routeTo === id) | ||
| .map((r) => r.workType) | ||
| .filter((workType) => !roleKey || workType.replace(/[.\s]+$/, '').trim().toLowerCase() !== roleKey); |
Author
There was a problem hiding this comment.
Fixed in 9e6f1ec: extracted a linear backward-scan helper stripTrailingDotsAndSpace and shared it across both role normalization and the routing workType filter to avoid regex backtracking. Re-verified locally with npm run build, npm run lint, npm run lint:eslint, and npx vitest run test/claude-members.test.ts (21/21 passed).
aloneangel45
force-pushed
the
aloneangel45/2528-claude-member-dedup-description
branch
from
November 26, 2026 01:38
3a02bf0 to
9e6f1ec
Compare
Closes github#2528 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
renderClaudeMemberfrontmatterdescriptionwhen the member'snamealready matchesrole(trimmed, case-insensitive, ignoring trailing punctuation/whitespace onrole).workTypeentries matchingrolefromOwns:so descriptions don't duplicate the role phrase, omittingOwns:altogether when no distinct work types remain.test/claude-members.test.tscovering role=name deduplication, case/trailing-dot normalization, mixed work types, and explicitPurposeprecedence, plus a changeset for@bradygaster/squad-sdk.Verification
npm run build(packages@bradygaster/squad-sdkand@bradygaster/squad-cli)npm run lint(tsc --noEmitacross both packages - 0 errors)npm run lint:eslint(0 errors)npx vitest run test/claude-members.test.ts(21/21 passed)node scripts/check-shebang-eol.mjs,node scripts/check-changeset-drift.mjs --mode=warn,node scripts/release/workspace-lockfile.mjs checkCloses #2528